package cn.asura.service.impl;

import cn.asura.pojo.BlogViews;
import cn.asura.pojo.DateAndView;
import cn.asura.mapper.BlogViewsMapper;
import cn.asura.service.BlogViewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author chen
 * @description
 * @createTime 2020-09-19 23:01
 */
@Component
public class BlogViewsServiceImpl implements BlogViewsService {
    @Autowired
    private BlogViewsMapper blogViewsMapper;

    @Override
    public List<BlogViews> findAll() {
        return blogViewsMapper.findAll();
    }

    @Override
    public List<DateAndView> findViewsByUserId(int id) {
        return blogViewsMapper.findViewsByUserId(id);
    }

    @Override
    public boolean add(int blogId, String ip, int userId) {
        return blogViewsMapper.add(blogId, ip, userId) != 0;
    }
}
